fix(commands/changelog): use topological order for commit ordering #677
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This MR comes from an issue raised here
Topological ordering should be used when ordering commits in changelog history. This allows commits to be shown properly in the order they were added to the codebase, even if non-linear merges were used
Checklist
./scripts/format
and./scripts/test
locally to ensure this change passes linter check and testExpected behavior
With a git history that has non-linear merges, I want my commits to be ordered in the order that they were introduced in the codebase.
So having a git graph like so:
If I merge
branchB
beforebranchA
like so:I expect the generated changelog to be this:
I also expect commands like
cz changelog v0.3.0
andcz changelog v0.2.0..v0.3.0
to produce identical changelogs forv.0.3.0
(which isn't currently the case - see issue)Steps to Test This Pull Request
branchA
branchB
branchA
feat: I will be merged second
branchB
feat: I will be merged first
main
branchB
intomain
branchA
intomain
cz changelog --dry-run
Additional context